home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 2.00 Begin Form Form1 BackColor = &H00C0C0C0& Caption = "Time Service Broadcast" ClientHeight = 4560 ClientLeft = 1350 ClientTop = 1590 ClientWidth = 6660 Height = 4965 Left = 1290 LinkTopic = "Form1" ScaleHeight = 4560 ScaleWidth = 6660 Top = 1245 Width = 6780 Begin UDPPORT UDPPort1 Height = 420 InBufferSize = 2048 Left = 4320 LocalPort = 0 MaxPacketSize = 2048 OutBufferSize = 2048 RegHandle = UDPTIME.FRX:0000 RemoteHost = "" RemotePort = 0 Top = 240 UseConnection = 0 'False Width = 420 WinsockLoaded = 0 'False End Begin ListBox lResponse Height = 3735 Left = 0 TabIndex = 0 Top = 720 Width = 6615 End Begin CommandButton bLookUp Caption = "Look Up!!" Default = -1 'True Height = 320 Left = 4920 TabIndex = 1 Top = 120 Width = 1455 End Begin Label Label1 BackStyle = 0 'Transparent Caption = "Clicking on the button will broadcast a request on the DAYTIME port on all the hosts on your LAN. Their times will be shown in the list below." ForeColor = &H00800000& Height = 675 Left = 120 TabIndex = 2 Top = 0 Width = 4335 End Sub bLookUp_Click () UDPPort1.WinsockLoaded = True UDPPort1.RemoteHost = "255.255.255.255" UDPPort1.RemotePort = 13 'daytime service lResponse.Clear If Not UDPPort1.Active Then UDPPort1.Active = True 'send anything and the server will send the time UDPPort1.DataToSend = "hello?" End Sub Sub Form_Resize () If WindowState <> 1 Then margin% = lResponse.Left lResponse.Width = ScaleWidth - 2 * margin% lResponse.Height = ScaleHeight - lResponse.Top - margin% End If End Sub Sub UDPPort1_DataIn (Datagram As String, SourceAddress As String, SourcePort As Integer) 'first do some cleanup... Do While Asc(Right$(Datagram, 1)) < 32 Datagram = Left$(Datagram, Len(Datagram) - 1) 'then show the time lResponse.AddItem SourceAddress & Chr$(9) & Datagram End Sub